<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <script src="js/mui.min.js"></script>
    <link href="css/mui.min.css" rel="stylesheet"/>
    <link rel="stylesheet" type="text/css" href="css/header.css"/>
    <link rel="stylesheet" href="fontico/iconfont.css" />
    <script type="text/javascript" charset="utf-8">
      	mui.init();
      	
		mui.plusReady(function(){
      		plus.navigator.setStatusBarStyle("light");
      		plus.navigator.setStatusBarBackground("#FF69B2");
      	});
      
    </script>
</head>
<body>
	
	<header class="mui-bar mui-bar-nav title">
	    <h1 class="mui-title title-color"><b>月聊</b></h1>
	</header>
	
	<nav class="mui-bar mui-bar-tab">
	    <a class="mui-tab-item mui-active" tabindex="0">
	        <span class="mui-icon iconfont icon-liaotian"></span>
	        <span class="mui-tab-label">月聊</span>
	    </a>
	    <a class="mui-tab-item" tabindex="1">
	        <span class="mui-icon iconfont icon-tongxunlu"></span>
	        <span class="mui-tab-label">通讯录</span>
	    </a>
	    <a class="mui-tab-item" tabindex="2">
	        <span class="mui-icon iconfont icon-zhinanzhen"></span>
	        <span class="mui-tab-label">发现</span>
	    </a>
	    <a class="mui-tab-item" tabindex="3">
	        <span class="mui-icon iconfont icon-wo"></span>
	        <span class="mui-tab-label">我</span>
	    </a>
	</nav>
	
	<script>
		var yueliaoArray = [
			{
				pageId:"hatlist.html",
				pageUrl:"hatlist.html",
			},
			{
				pageId:"contact.html",
				pageUrl:"contact.html",
			},
			{
				pageId:"disover.html",
				pageUrl:"disover.html",
			},
			{
				pageId:"me.html",
				pageUrl:"me.html",
			}
		];
		
		var yueliaoStyle = {
			top: "44px",
			bottom: "50px"
		}
		
		mui.plusReady(function(){
			
			//禁止返回到登录页面
			mui.back = function(){
				return false;
			};
			
			//穿线当前主页的webview对象
			var indexWebview = plus.webview.currentWebview();
			
			//向当前的主页webview追加子页的4章webview对象
			for(var i = 0; i < yueliaoArray.length; i++){
				var yueliaoPage = plus.webview.create(yueliaoArray[i].pageUrl,yueliaoArray[i].pageId,yueliaoStyle);
				
				//隐藏webview
				yueliaoPage.hide();
				//追加每个子页到当前页面
				indexWebview.append(yueliaoPage);
			}
			plus.webview.show(yueliaoArray[0].pageId);
			
			//绑定tab事件，显示不同页面
			mui(".mui-bar-tab").on("tap","a",function(){
				
				var tabindex = this.getAttribute("tabindex");
				
				//显示点击的tab选项所对应的页面
				plus.webview.show(yueliaoArray[tabindex].pageId,"fade-in",200);
				
				//隐藏其他页面
				for(var i=0; i < yueliaoArray.length;i++){
					if(i != tabindex ){
						plus.webview.hide(yueliaoArray[i].pageId,"fade-out",200);
					}
				}
				
			});
			
		})
		
		
		
	</script>
	
</body>
</html>